﻿@model ByHand.Model.Product
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
    var cul = System.Globalization.CultureInfo.GetCultureInfo("vi-VN");
    var imgs = Model.ImagePath.Split(';').Where(i => i.Length > 0).ToList();
    for (int i = 0; i < imgs.Count; i++)
    {
        imgs[i] = imgs[i] + "?w=698&h=371&q=90&format=jpg&mode=crop";
    }
    var options = ViewData["options"] as List<ByHand.Model.ProductOption>;
    var bgcolor = Model.Provider.BgColor;
    var linkcolor = Model.Provider.LinkColor;
    var isresultpayment = ViewData["ResultPayment"] != null;
    var resultpayment = new ByHand.Services.Code.SohaResult();
    if (isresultpayment)
    {
        resultpayment = ViewData["ResultPayment"] as ByHand.Services.Code.SohaResult;
    }
    var user = ViewData["User"] as ByHand.Model.User;
}
<style>
    body {
        background-color: #@bgcolor;
    }

    .border-top {
        border-top-width: 1px;
        border-top-style: solid;
        border-top-color: #@linkcolor;
    }

    .border-bottom {
        border-bottom: 1px;
        border-bottom-style: solid;
        border-bottom-color: #@linkcolor;
    }

    .container-narrow a {
        color: #@linkcolor;
    }

        .container-narrow a:hover {
            color: #@linkcolor;
        }

    .header.nav > li > a:hover, .nav > li > a:focus {
        background-color: #@linkcolor;
        color: #@bgcolor;
    }

    a.carousel-control {
        background-color: none!important;
    }

    .container-narrow {
        border: 1px solid #@linkcolor;
    }

    .price {
        color: #@linkcolor;
    }

    .discount {
        color: #@linkcolor;
    }

    .bg2 {
        background: url(images/bg_loop.png) repeat;
        min-height: 1080px;
        -moz-user-select: none;
        overflow: hidden;
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        z-index: -1;
    }

    .bg {
        background: url(images/bg.jpg) top center no-repeat;
        min-height: 1080px;
        -moz-user-select: none;
        overflow: hidden;
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        z-index: -1;
        min-width: 1200px;
        background-size: 100% auto;
    }
</style>
<!-- <div class="bg"></div>
	<div class="bg2"></div> -->
<div class="container-narrow">
    <div class="header">
        <ul class="nav nav-pills pull-right">
            @if (User.Identity.IsAuthenticated)
            {
                <li>
                    <div id="loaded"></div>
                    <a href="javascript:;" id="userStatistic">@(user.ProperName??user.Email)</a></li>
                <li><a href="javascript:;" id="logout">Thoát</a></li>
            }
            else
            {
                <li><a href="javascript:;" onclick="showlogin()">Đăng nhập</a></li>
                <li><a href="javascript:;" onclick="showreg()">Đăng ký</a></li>
            }
        </ul>
        <h3>
            <img class="logo" src="@Model.Provider.LogoImage" /></h3>
    </div>
    <div class="product-media">
        <div id="carousel-example-generic" class="carousel slide border-top border-bottom">
            <!-- Indicators -->
            <ol class="carousel-indicators">
                <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
                <li data-target="#carousel-example-generic" data-slide-to="1"></li>
            </ol>

            <!-- Wrapper for slides -->
            <div class="carousel-inner">
                @foreach (var item in imgs)
                {
                    <div class="item @(imgs.IndexOf(item) == 0 ? "active" : "")">
                        <img src="@item" alt="...">
                    </div>
                }
            </div>

            <!-- Controls -->
            <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
                <span class="icon-prev"></span>
            </a>
            <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
                <span class="icon-next"></span>
            </a>
        </div>
    </div>
    <div class="product-info">
        <h1>@Model.Title</h1>
        <p class="lead">@Model.Introduction</p>
    </div>
    <div class="row marketing">
        <div class="col-lg-6">
            @MvcHtmlString.Create(HttpUtility.HtmlDecode(Model.Description))
        </div>
        <div class="col-lg-6">
            <div class="well well-lg">
                <p class="price">@(Model.Price)đ <span class="original-price">@(Model.BasePrice)đ</span></p>
                <p><a type="button" data-toggle="modal" onclick="call_payment(this,@Model.ID)"  class="btn btn-primary btn-lg"><span class="glyphicon glyphicon-shopping-cart"></span>&nbsp;Đặt hàng</a> <span class="discount">Giảm 40%</span></p>
            </div>
            <h4>Thông tin sử dụng</h4>
            <p>Maecenas sed diam eget risus varius blandit sit amet non magna.</p>
            <h4>Kiếm thêm thu nhập</h4>
            <p>Bấm like Facebook hoặc gửi link cho bạn bè để có cơ hội nhận <strong>5%</strong> hoa hồng cho mỗi đơn hàng giới thiệu.</p>
            <p><a href="javascript:;" id="btn-create-widget"><span class="glyphicon glyphicon-usd"></span>Tìm hiểu thêm</a></p>
        </div>
    </div>
    <div class="footer border-top">
        <p>&copy; <strong>@Model.Provider.Name</strong> bán hàng qua hệ thống <a href="http://byhand.vn" target="_blank">ByHand.vn</a></p>
    </div>
</div>
<!-- /container -->
<!-- dialog login -->
<div id="login" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body dialog-background">
                <p class="fb-login-button text-center">
                    <button class="btn-facebook" id="btn-fblogin">Đăng nhập bằng Facebook</button>
                </p>
                <p class="or-login text-center"><span class="or-text">hoặc điền</span></p>
                @using (Html.BeginForm("Login", "Home", FormMethod.Post, new { Class = "form-horizontal cnt-center", id = "shared-login" }))
                {
                    <div id="shared-login-email" class="input-group" style="margin-bottom: 13px;">
                        <span class="input-group-addon">Email &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                        <input type="text" class="form-control" name="email" placeholder="Email">
                        <span class="help-inline"></span>
                    </div>
                    <div id="shared-login-password" class="input-group" style="margin-bottom: 13px;">
                        <span class="input-group-addon">Mật Khẩu</span>
                        <input type="password" class="form-control" name="password" placeholder="Mật khẩu">
                    </div>
                    <p class="help-inline" style="color: red; text-align: center" id="login-mess"></p>
                    <div class="input-group" style="margin: 0 0 13px 221px;">
                        <div class="controls vn-modal-input">
                            <button type="submit" class="btn btn-danger" id="shared-login-btn">Đăng nhập</button>
                        </div>
                    </div>
                }
            </div>
        </div>
    </div>
</div>
<!-- /dialog login -->
<!-- dialog statistic -->
<div id="statistic" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
    <div class="modal-dialog" style="width:860px;">
        <div class="modal-content">
            <div class="modal-body dialog-background" id="statisticContent" style="padding-top:20px">
                
            </div>
        </div>
    </div>
</div>
<!-- /dialog statistic -->
<!-- dialog register -->
<div id="reg" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body dialog-background">
                <div class="slide-box">
                    <p class="fb-login-button text-center">
                        <button class="btn-facebook" onclick="signUpFB()" id="btn-fbsignup">Dùng Facebook đăng ký</button>
                    </p>
                    <p class="or text-center">hoặc điền các thông tin sau</p>
                    @using (Html.BeginForm("AddUser", "User", FormMethod.Post, new { Class = "form-horizontal", id = "shared-reg" }))
                    {
                        <div class="control-group" id="control-email" style="margin-bottom: 13px;">
                            <div class="input-group">
                                <span class="input-group-addon control-label">Email &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                                <input type="text" class="form-control" name="email" placeholder="Email">
                            </div>
                            <span class="control-label" id="email-mess"></span>
                        </div>
                        <div id="control-password" class="control-group" style="margin-bottom: 13px;">
                            <div class="input-group">
                                <span class="input-group-addon control-label">Mật Khẩu</span>
                                <input type="password" class="form-control" name="password" id="signup-password-input" placeholder="Mật khẩu" style="" /><input type="text" style="display: none;" name="password-clone"><input type="text" name="undefined-clone" style="display: none;">
                            </div>
                            <span class="control-label" id="password-mess"></span>
                        </div>
                        <div class="control-group">
                            <div class="controls vn-modal-input">
                                <div class="input-prepend">
                                    <label class="checkbox" for="show-password">
                                        <input type="checkbox" name="show-password" id="show-password" value="Kiểm tra mật khẩu">
                                        Kiểm tra mật khẩu
                                    </label>
                                </div>
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="input-group" style="margin: 0 0 13px 221px;">
                                <input type="submit" class="btn btn-danger" id="signup-btn" value="Đăng ký" />
                            </div>
                        </div>
                    }
                </div>
            </div>
        </div>
    </div>
</div>
@*generate only for display result payment*@
@if (isresultpayment)
{
    <style>
        #result-payment-modal .modal-body {
            padding: 20px;
        }

        #result-payment-modal .labelinfo {
            padding: 5px;
            width: 20%;
            float: left;
            font: 12px;
        }

        #result-payment-modal .datainfo {
            padding: 5px;
            width: 70%;
            float: left;
            font: 12px;
        }

        .clear {
            clear: both;
        }

        #result-payment-modal textarea {
            width: 80%;
            float: left;
            resize: vertical;
            height: 34px;
        }
    </style>
    <div class="modal fade" id="result-payment-modal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title">Kết quả thanh toán</h4>
                </div>
                <div class="modal-body">
                    <div class="result-detail-note">
                        <span>Ghi chú về địa chỉ và giờ giấc nhận hàng để hàng đến tay bạn được nhanh nhất:</span>
                        <form class="form-inline">
                            <div id="result-payment-message"></div>
                            <input type="hidden"  value="@resultpayment.OrderID" />
                            <textarea class="form-control"></textarea><input type="button" class="btn btn-default" value="Lưu" style="float: left;" onclick="postcustomernote();" />
                        </form>
                        <div class="clear"></div>
                    </div>
                    <div class="result-detail-info">
                        <h3>Thông tin đơn hàng</h3>
                        <div>
                            <div class="labelinfo">Mã đơn hàng:</div>
                            <div class="datainfo">@resultpayment.Order.ID</div>
                            <div class="clear"></div>
                        </div>
                        <div class="row">
                            <div class="labelinfo">Trạng thái:</div>
                            <div class="datainfo" style="color: red; font-weight: bolder;">@resultpayment.GetMessage()</div>
                            <div class="clear"></div>
                        </div>
                        <div class="row">
                            <div class="labelinfo">Phương thức:</div>
                            <div class="datainfo" style="color: red; font-weight: bolder;">@(ByHand.Services.Code.EnumUtility.GetNameEnumPayType(resultpayment.Order.PayType ?? 0))</div>
                            <div class="clear"></div>
                        </div>
                        <div class="row">
                            <div class="labelinfo">Họ Tên:</div>
                            <div class="datainfo">@resultpayment.Order.ToName</div>
                            <div class="clear"></div>
                        </div>
                        <div class="row">
                            <div class="labelinfo">Email:</div>
                            <div class="datainfo">@resultpayment.Order.ToEmail</div>
                            <div class="clear"></div>
                        </div>
                        <div class="row">
                            <div class="labelinfo">Số điện thoại:</div>
                            <div class="datainfo">@resultpayment.Order.ToPhone</div>
                            <div class="clear"></div>
                        </div>
                        <div class="row">
                            <div class="labelinfo">Địa chỉ:</div>
                            <div class="datainfo">@(resultpayment.Order.ToAddress)(@resultpayment.Order.ToDistrict.Name - @resultpayment.Order.ToCity.Name)</div>
                            <div class="clear"></div>
                        </div>
                    </div>
                    <div class="result-detail-cart">
                        <h3>Thông tin sản phẩm</h3>
                        <table class="table table-bordered table-condensed">
                            <tbody>
                                <tr>
                                    <th>Sản phẩm</th>
                                    <th>Số lượng</th>
                                    <th>Giá tiền</th>
                                    <th>Tổng</th>
                                </tr>
                                @foreach (var item in resultpayment.Order.OrderDetail)
                                {
                                    <tr>
                                        <td>@Model.Title<br />@ByHand.Services.Code.Utility.ParseOptionValue(item.OptionsValue)</td>
                                        <td>@item.Quantity</td>
                                        <td>@Model.Price</td>
                                        <td>@(Model.Price * item.Quantity)đ</td>
                                    </tr> 
                                }
                                <tr>
                                    <td colspan="3"><strong>Tổng Tiền</strong></td>
                                    <td id="byhand-final-money"><strong>@(resultpayment.Order.Quantity * Model.Price)đ</strong></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
    <!-- /.modal -->
    <script>
        $(document).ready(function () {
            $('#result-payment-modal').modal('show');
        });
        function postcustomernote() {
            var note = $('#result-payment-modal').find('textarea').val();
            var orderid = $('#result-payment-modal').find('input[type=hidden]').val();
            $.post("/Order/SaveNoteOrder", { orderid: orderid, note: note }, function (data) {
                var html = "";
                if (data.result == true) {
                    var html = '<div class="alert alert-warning fade in"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>Đã lưu thành công.</div> ';
                } else {
                    var html = '<div class="alert alert-warning fade in"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>Không lưu thành công.</div> ';
                }
                $('#result-payment-message').html(html);
            });
        }
    </script>
}
<!-- /dialog register -->
<style>
    /*make modal create widget more space*/
    #byhand-create-widget .modal {
        /* new custom width */
        overflow: hidden;
        /* must be half of the width, minus scrollbar on the left (30px) */
        margin-left: 0px;
    }

    #byhand-create-widget .modal-dialog {
        width: 800px;
    }

    .tab-pane {
        padding-top: 10px;
    }
</style>
<div class="modal fade" id="byhand-create-widget">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">Tạo widget của bạn</h4>
            </div>
            <div class="modal-body">
                <ul class="nav nav-tabs">
                    <li class="active"><a href="#get-share-link" data-toggle="tab" data-step="1">Lấy Link</a></li>
                    <li><a href="#get-share-button" data-toggle="tab" data-step="2">Lấy Button</a></li>
                    <li><a href="#get-share-widget" data-toggle="tab" data-step="3">Lấy Widget</a></li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active" id="get-share-link">
                        <div class="input-group" style="width: 300px; padding: 5px;">
                            <input type="button" class="btn btn-success" value="Lấy Link chia sẻ" id="btn-link-share">
                        </div>
                        <div class="input-group" style="width: 300px; padding: 5px;" id="exec-link-share">
                        </div>
                        <div class="input-group" style="width: 300px; padding: 5px;">
                            <textarea class="form-control" style="max-width: 300px; width: 300px;" id="display-link-share">Mã nhúng ở đây</textarea>
                        </div>
                    </div>
                    <div class="tab-pane" id="get-share-button">
                        <div style="width: 420px; height: 500px; float: right; border: solid 1px #d3bcbc; overflow: auto;" id="preview-embled-button">
                        </div>
                        <div class="input-group" style="width: 300px; padding: 5px;">
                            <span class="input-group-addon">Chiều Rộng:</span>
                            <input type="text" class="form-control" placeholder="Chiều rộng" id="embled-button-width">
                            <div class="input-group-btn">
                                <select class="form-control" id="embled-button-width-unit">
                                    <option selected value="px">px</option>
                                    <option value="%">%</option>
                                </select>
                            </div>
                        </div>
                        <div class="input-group" style="width: 300px; padding: 5px;">
                            <span class="input-group-addon">Chiều Dài</span>
                            <input type="text" class="form-control" placeholder="Chiều dài" id="embled-button-height">
                            <div class="input-group-btn">
                                <select class="form-control" id="embled-button-height-unit">
                                    <option selected value="px">px</option>
                                    <option value="%">%</option>
                                </select>
                            </div>
                        </div>
                        <div class="input-group" style="width: 300px; padding: 5px;">
                            <input type="button" class="btn btn-success" onclick="create_btn_embled(1);" value="Lấy html button" id="embled-button-div">
                            <input type="button" class="btn btn-success" onclick="create_btn_embled(2);" value="Lấy frame button" id="embled-button-frame">
                        </div>
                        <div class="input-group" style="width: 300px; padding: 5px;">
                            <textarea class="form-control" style="max-width: 300px; width: 300px;" id="display-button-share">Mã nhúng ở đây</textarea>
                        </div>
                        <div style="clear: both;"></div>
                    </div>
                    <div class="tab-pane" id="get-share-widget">
                        <div style="width: 420px; height: 500px; float: right; border: solid 1px #d3bcbc; overflow: auto;" id="widget-preview">
                        </div>
                        <div class="input-group" style="width: 300px; padding: 5px;">
                            <span class="input-group-addon">Width</span>
                            <input type="text" class="form-control" placeholder="Chiều rộng" id="widget-width">
                        </div>
                        <div class="input-group" style="width: 300px; padding: 5px;">
                            <input type="button" class="btn btn-success" value="Lấy Mã Widget" id="widget-getcode">
                        </div>

                        <div class="input-group" style="width: 300px; padding: 5px;">
                            <textarea class="form-control" style="max-width: 300px; width: 300px;" id="widget-copycode">Mã nhúng ở đây</textarea>
                        </div>
                        <div style="clear: both;"></div>
                    </div>
                </div>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<script>
    var productid = '@Model.ID';
    var callpopup = '@ViewData["callpopup"]';
    var tempID = '@(ViewData["tempId"] ?? "0")';
    var userid = '@(ViewData["userid"] ?? "0")';
    $(document).ready(function () {
        $('.carousel').carousel({
            interval: 5000
        });
        if (callpopup == "true") {
            call_payment(null, productid, tempID);
        }
        $('#shared-login').ajaxForm(function (data) {
            if (data) {
                window.location.reload();
            } else {
                $('#login-mess').text('Sai tài khoản hoặc mật khẩu?');
            }
        });
        $('#shared-reg').ajaxForm(function (data) {
            if (data.success) {
                window.location.reload();
            } else {
                if (data.email.length > 0) {
                    $('#control-email').addClass('has-error');
                    $('#email-mess').text(data.email);
                }
                if (data.password.length > 0) {
                    $('#control-password').addClass('has-error');
                    $('#password-mess').text(data.password);
                }
            }
        });
		$(window).resize(function(){
		   var width = $(window).width();
		   if(width <= 500){
		       $('.nav-pills').addClass('nav-stacked');
		   }
		})
		.resize();
    });
    //for create widget

    $('#btn-create-widget').click(function () {
        $('#byhand-create-widget').modal('show');
    });
    $('#widget-getcode').click(function () {
        var width = $('#widget-width').val();
        if (width <= 0 || isNaN(width)) {
            alert("Bạn chưa nhập hoặc nhập sai chiều rộng widget.");
            return;
        }
        //var height = $('#widget-height').val();
        //var name = $('#widget-name').val();
        if (width == "") width = 100;
        //if (height == "") height = 50;
        if (isNaN(width)) return;
        //if (isNaN(height)) return;
        var height = 0;
        var display = '<div class="byhand-payment" data-width="' + width + '" data-id="' + productid + '"  data-refid="' + userid + '"></div>' +
            '<script src="http://byhand.vn/Content/js/byhand_payment.js" type="text/javascript"></sc' + 'ript>';
        $('#widget-preview').html(display);
        $('#widget-copycode').val(display);
    });
    $('#btn-link-share').click(function () {
        var link = "<a href='/home/index?refid=" + userid + "&id=" + productid + "' >http://byhand.vn/home/index?refid=" + userid + "&id=" + productid + "</a>";
        $('#exec-link-share').html(link);
        $('#display-link-share').html(link);
    });
    function create_btn_embled(type) {
        var width = $('#embled-button-width').val();
        var widthunit = $('#embled-button-width-unit').val();
        var height = $('#embled-button-height').val();
        var heightunit = $('#embled-button-height-unit').val();
        if (width <= 0 || isNaN(width)) {
            alert("Bạn chưa nhập hoặc nhập sai chiều rộng.");
            return;
        }
        if (height <= 0 || isNaN(height)) {
            alert("Bạn chưa nhập hoặc nhập sai chiều dài.");
            return;
        }
        var html = "<input type='button' value='Mua' data-refid='" + userid + "' class='btn btn-success' onclick='embed_call_payment(this," + productid + ")' style='width:100%;height:100%;' />";
        if (type == 1) {
            html = "<div style='width:" + width + widthunit + ";height:" + height + heightunit + ";'>" + html + "<scri" + "pt src='http://byhand.vn/Content/js/byhand_payment_embed.js'></scr" + "ipt></div>";
        } else {
            html = "<iframe src='http://byhand.vn/payment/buttonshared?id=" + productid + "&refid=" + userid + "' style='width:" + width + widthunit + ";height:" + height + heightunit + ";padding:0px;' frameborder='0' scrolling='no'></iframe>";
        }
        $('#preview-embled-button').html(html);
        $('#display-button-share').val(html);
    }
    function showlogin() {
        $('#login').modal({
            show: true
        });
    }
    function showreg() {
        $('#reg').modal({
            show: true
        });
    }

    $('#show-password').click(function () {
        var inp = $('#signup-password-input').val();
        if ($('#show-password').is(':checked')) {
            $('#signup-password-input').replaceWith('<input type="text" class="form-control" name="password" id="signup-password-input" placeholder="Mật khẩu" style="" />');
            $('#signup-password-input').val(inp);
        } else {
            $('#signup-password-input').replaceWith('<input type="password" class="form-control" name="password" id="signup-password-input" placeholder="Mật khẩu" style="" />');
            $('#signup-password-input').val(inp);
        };
    });

    //login , signup facebook DucNT
    function fbEnsureInit(callback) {
        if (FB == undefined) {
            setTimeout(function () { fbEnsureInit(callback); }, 50);
        } else {
            if (callback) {
                callback();
            }
        }
    }
    // btn login click
    $('#btn-fblogin').click(function () {
        fbEnsureInit(function () {
            FB.getLoginStatus(function (response) {
                if (response.status == "connected") {
                    $('#fbID').val(response.authResponse.userID);
                    FB.api('/me', function (resp) {
                        $('#fbname').val(resp.name);
                        $('#fbemail').val(resp.email);
                        $.ajax({
                            type: "POST",
                            url: '@Url.Action("SignUpFB", "Home")',
                            data: $('#form-loginFB').serialize(), // serializes the form's elements.
                            success: function (d) {
                                localStorage['autologin'] = true;
                                location.reload();
                            },
                        });
                    });
                } else {
                    signUpFB();
                }
            });
        });
    });
    // sign up function
    function signUpFB() {
        FB.login(function (r) {
            if (r.status == 'connected') {
                localStorage['autologin'] = true;
                FB.api('/me', function (resp) {
                    $.post('@Url.Action("SignUpFB", "Home")', { fbID: resp.id, fbname: resp.name, fbemail: resp.email }, function (u) {
                        location.reload();
                    });
                });
                }
        }, { scope: 'email' });
    }
    // user statistic
    $('#userStatistic').click(function () {
        $.post('@Url.Action("UserStatistic","Home")', { userid: '@(user== null ? 0:user.ID)' }, function (data) {
            $('#statisticContent').html(data);
            $('#statistic').modal({
                show: true
            });
        });
    });
</script>
@*FB.api('/me/viecnho:register', 'post', {
                                        account: 'http://viecnho.com/' + u.ID
                                    }, function (response) {
                                        FB.api('/me/picture?width=180&height=180', function (re) {
                                            $.post('@Url.Action("AddFBAvatar", "Home")', { fbID: u.FbID, url: re.data.url }, function (reval) {
                                            });
                                        });
                                    });*@